#! /bin/bash
## author:XueXianqi

echo `date '+%Y-%m-%d %H:%M:%S'` '正在为您安装Python虚拟环境'
sudo apt-get install python3-pip -y
sudo mkdir ~/.pip
(
echo "[global]
index-url = https://pypi.douban.com/simple"
echo "[install]
use-mirrors =true
mirrors =https://pypi.douban.com/simple/
trusted-host =pypi.douban.com"
) >> ~/.pip/pip.conf
pip3 install virtualenv
pip3 install virtualenvwrapper
sed -i 's/which python)/which python3)/' /usr/local/bin/virtualenvwrapper.sh
bash
echo "
export WORKON_HOME=/virtualenvs
/usr/local/bin/virtualenvwrapper.sh
" >> ~/.bashrc
source ~/.bashrc
echo `date '+%Y-%m-%d %H:%M:%S'` 'Python虚拟环境安装完成'